package source;


import java.util.LinkedList;

import org.newdawn.slick.AppGameContainer;
import org.newdawn.slick.BasicGame;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Input;
import org.newdawn.slick.SlickException;



public class Game extends BasicGame {
	private LinkedList<HitableObject> objectListNormal;
	private LinkedList<HitableObject> objectListBackground;
	private LinkedList<HitableObject> objectListForeground;
	private Player player;

	public Game() {
		super("The Ethernal Void!");
	}

	public void init(GameContainer container) throws SlickException {
		objectListNormal = new LinkedList<HitableObject>();
		objectListBackground = new LinkedList<HitableObject>();
		objectListForeground = new LinkedList<HitableObject>();
		player = new Player();
		objectListNormal.add(player);
		player.x = 20;
		player.y = 200;
		
	}

	public void update(GameContainer container, int delta)
			throws SlickException {

		 if (container.getInput().isKeyDown(Input.KEY_W)) {
			 player.y--;
		 }

		container.setVSync(true);
		
	}


	public void render(GameContainer container, Graphics g) {
		for(HitableObject cur : objectListBackground)
		{
			g.drawImage(cur.image, cur.x, cur.y);
		}
		for(HitableObject cur : objectListNormal)
		{
			g.drawImage(cur.image, cur.x, cur.y);
		}
		for(HitableObject cur : objectListForeground)
		{
			g.drawImage(cur.image, cur.x, cur.y);
		}
	}

	public static void main(String[] argv) throws SlickException {
		AppGameContainer container = new AppGameContainer(new Game(), 1092,
				720, false);
		container.setTargetFrameRate(60);
		container.start();
	}
}
